﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dqs_BLL;
using Model;
using Sunny.UI;

namespace Dqs_UI
{
	public partial class frmAddCourse : UIForm
	{
		public frmAddCourse()
		{
			InitializeComponent();
		}

		Course_BLL course_BLL = new Course_BLL();
		Teacher_BLL teacher_BLL = new Teacher_BLL();

		/// <summary>
		/// 添加
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void uiButton1_Click(object sender, EventArgs e)
		{
			CourseInfo courseInfo = new CourseInfo()
			{
				CourseName = txtCourseName.Text.Trim(),
				StartTime = Convert.ToDateTime(txtStartTime.Text.Trim()),
				EndTime = Convert.ToDateTime(txtEndTime.Text.Trim()),
				Description = txtDescription.Text.Trim()
			};
		
			if (course_BLL.InsertCourseInfo(courseInfo))
			{
				DialogResult = DialogResult.OK;
			}
			else
			{
				MessageBox.Show("请检查输入内容是否正确！");
			}
		}

		private void frmAddCourse_Load(object sender, EventArgs e)
		{
			
		}

		private void uiButton2_Click(object sender, EventArgs e)
		{
			txtCourseName.Clear();
			txtDescription.Clear();
			txtEndTime.Clear();
			txtStartTime.Clear();
		}
	}
}
